﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.Utils;
using System.Linq;

namespace DevEx.QuocSy.UserControl
{
    public partial class ucTongGiaTriHangXuat : DevExpress.XtraEditors.XtraUserControl
    {
        public ucTongGiaTriHangXuat()
        {
            InitializeComponent();
        }

        private void btnXem_Click(object sender, EventArgs e)
        {
            QLVTDataContext dc = new QLVTDataContext();
            //var q = from p in dc.sp_Sy_BaoCaoTongGiaTriHangXuat(Convert.ToDateTime(dtpTuNgay.EditValue), Convert.ToDateTime(dtpDenNgay.EditValue))
            //        select p;

            //dtgBaoCao.DataSource = q;
            //FormatdtgBaoCao();
        }
        public void FormatdtgBaoCao()
        {
            //Columns DonVi
            var cl_DonVi = gridView1.Columns["DonVi"];
            cl_DonVi.Width = 250;
            cl_DonVi.Caption = "Đơn vị";
            cl_DonVi.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
            cl_DonVi.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;

            //Columns SoHopDong
            var cl_SoHopDong = gridView1.Columns["SoHopDong"];
            cl_SoHopDong.Width = 150;
            cl_SoHopDong.Caption = "Số hợp đồng";
            cl_SoHopDong.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
            cl_SoHopDong.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;

            //Columns TongGiaTri
            var cl_TongGiaTri = gridView1.Columns["TongGiaTri"];
            cl_TongGiaTri.Width = 120;
            cl_TongGiaTri.Caption = "Tổng Giá Trị";
            cl_TongGiaTri.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Far;
            cl_TongGiaTri.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            cl_TongGiaTri.DisplayFormat.FormatString = "#,###";
        }
    }
}
